﻿$(function () {
    grid.bind();
    //AddUser();
});

var grid = {
    bind: function () {
        var winSize = { width: $(window).width() - 4, height: $(window).height() - 40 };
        $('#list').datagrid({
            url: "",//  /Admin/GetMenuList
            title: "新闻列表",
            iconCls: 'icon icon-list',
            width: winSize.width,
            height: winSize.height,
            nowrap: true, //false:折行
            rownumbers: true, //行号
            striped: true, //隔行变色
            idField: 'Id', //主键
            singleSelect: true, //单选
            checkOnSelect: true,
            columns: [[
                    { title: '主键', field: 'Id', hidden: true },
                    { title: '编号', field: 'Code', width: 150 },
                    { title: '登录名', field: 'UserName', width: 150, sortable: true },
                    { title: '用户名', field: 'RealName', width: 150 },
                    { title: '部门', field: 'DepartmentName', width: 150 },
                    { title: '角色主键', field: 'RoleId', hidden: true },
                    { title: '有效', field: 'Enabled', width: 50},
                    { title: '邮箱地址', field: 'Email', width: 150 },
                    { title: '手机号码', field: 'Mobile', width: 150 },
                    { title: '描述', field: 'Description', width: 200 },
                    { title: 'Enabled', field: 'Enabled', hidden: true },
                    { title: 'Gender', field: 'Gender', hidden: true },
                    { title: 'UserPassword', field: 'UserPassword', hidden: true },
                    { title: 'Birthday', field: 'Birthday', hidden: true },
                    { title: 'Telephone', field: 'Telephone', width: 200, hidden: true },
                    { title: 'Duty', field: 'Duty', hidden: true },
                    { title: 'QICQ', field: 'QICQ', hidden: true },
                    { title: 'Title', field: 'Title', hidden: true },
                    { title: 'RoleId', field: 'RoleId', hidden: true },
                    { title: 'CompanyId', field: 'CompanyId', hidden: true },
                    { title: 'CompanyName', field: 'CompanyName', hidden: true },
                    { title: 'DepartmentId', field: 'DepartmentId', hidden: true },
                    { title: 'DepartmentName', field: 'DepartmentName', hidden: true },
                    { title: 'WorkgroupId', field: 'WorkgroupId', hidden: true },
                    { title: 'WorkgroupName', field: 'WorkgroupName', hidden: true },
                    { title: 'HomeAddress', field: 'HomeAddress', hidden: true }
            ]]
        });
    },
    getSelectedRow: function () {
        return $('#list').datagrid('getSelected');
    }
};

var AddUser = function () {
    $('#a_add').click(function () {
        alert("添加");
    })
};